<template>
	<view class="productSort">
		<view class='header acea-row row-center-wrapper'>
			<view class='acea-row row-between-wrapper input'>
				<text class='iconfont icon-sousuo'></text>
				<input type='text' placeholder='点击搜索支行信息' @confirm="searchSubmitValue" confirm-type='search' name="search"
				 placeholder-class='placeholder' maxlength="20"></input>
			</view>
		</view>
		
		<view class="street-box">
			<view style="position: relative;" class="pad-30">
				<view class="bankItem" v-for="(item,index) in bankList" :key="index" @click="selectItem(item)">
					<view>
						<text>{{item.bankName}}</text>
					</view>
				</view>
			</view>
			<view class='loadingicon acea-row row-center-wrapper'>
				<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
			</view>
			<view class='no-shop' v-if="bankList.lengthg">
				<view class='pictrue' style="margin: 0 auto;text-align: center;">
					<!-- <image src='/static/images/no-shop.png'></image> -->
					<text>未查询到支行信息</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getYsBankChildListApi
	} from '@/api/apply.js';
	export default {
		data() {
			return {
				bankList: [],
				loading: false,
				where: {
					cityCode: '',
					bankName: '',
					bankType: '',
				},
				type: 0
			}
		},
		onLoad(option) {
			console.log(option);
			this.where.cityCode = option.cityCode;
			this.where.bankType = option.bankType!=null&&option.bankType!='null'?option.bankType:'';
			this.type = option.type;
			this.getBankList();
		},
		methods: {
			getBankList: function(){
				let that = this;
				getYsBankChildListApi(that.where).then(res =>{
					that.bankList = res.data;
					that.loading = true;
				});
			},
			selectItem(item) {
				if(this.type==0){
					uni.$emit('returnData', item)
				}
				if(this.type==1){
					uni.$emit('returnStandData', item)
				}
				uni.navigateBack({
					delta: 1
				});
			},
			searchSubmitValue: function(e) {
				let that = this;
				if (this.$util.trim(e.detail.value).length > 0){
					that.where.bankName = e.detail.value;
					that.getBankList();
				}else{
					return this.$util.Tips({
						title: '请填写要搜索的支行信息'
					});
				}
			},
		}
	}
</script>

<style scoped lang="scss">
	.productSort {
		display: flex;
		flex-direction: column;
		width: 100%;
		.con-box {
			flex: 1;
			display: flex;
			overflow: hidden;
		}
	}
	.productSort .header {
		width: 100%;
		height: 96rpx;
		background-color: #fff;
		border-bottom: 1rpx solid #f5f5f5;
	}
	.productSort .header .input {
		width: 700rpx;
		height: 60rpx;
		background-color: #f5f5f5;
		border-radius: 50rpx;
		box-sizing: border-box;
		padding: 0 25rpx;
	}

	.productSort .header .input .iconfont {
		font-size: 28rpx;
		color: #555;
	}
	.productSort .header .input .placeholder {
		color: #999;
	}
	.productSort .header .input input {
		font-size: 28rpx;
		height: 100%;
		width: 597rpx;
	}
	.productSort .header .input .input-box {
		display: flex;
		align-items: center;
		font-size: 28rpx;
		height: 100%;
		width: 597rpx;
		color: #999999;
	}
	.bankItem{
		background-color: #fff;
		padding: 20rpx;
		font-size: 30rpx;
		border-radius: 20rpx;
		margin-top: 20rpx;
		margin-left: 32rpx;
		margin-right: 32rpx;
	}
</style>
